package com.kyg.tjtoolmanager.controller;

import com.kyg.tjtoolmanager.App;
import com.kyg.tjtoolmanager.db.SQLiteUtils;
import com.kyg.tjtoolmanager.ui.StageFactory;
import com.kyg.tjtoolmanager.ui.StageListener;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.layout.FlowPane;

import java.net.URL;
import java.util.ResourceBundle;

public class BaseController implements Initializable, StageListener {

    @FXML
    public FlowPane rootLayout;
    public static String fxmlStr;

    public void onBindData(Object object){

    }

    @Override
    public void onShow() {
        SQLiteUtils.insertLog("BaseController onShow");
    }

    @Override
    public void onClose() {
        StageFactory.removeStageListener(fxmlStr);
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        fxmlStr = location.getFile().toString();
        fxmlStr = fxmlStr.substring(fxmlStr.lastIndexOf("/") + 1);
        SQLiteUtils.insertLog("Controller 加载：" + fxmlStr);
        StageFactory.addStageListener(fxmlStr,this);
    }
}
